package com.feihao.zhou.demoVolatileUseSynchronized;

public class MyThread1 implements Runnable {
    private Money money;

    public MyThread1(Money money) {
        this.money = money;
    }

    @Override
    public void run() {
        while (true) {
            synchronized (money) {
                if (money.getMoney() != 10000) {
                    System.out.println("钱不是10000了");
                    break;
                }
            }
        }

    }
}
